function ajaxGet(url, cb, data){
    data = data || {};
    let str = "";
    for(let i in data){
        str += `${i}=${data[i]}&`
    }
    url += "?" + str + "_qft_=" + Date.now();
    const xhr = new XMLHttpRequest();
    xhr.open("get", url, true);
    xhr.onreadystatechange = function(){
        if(xhr.readyState === 4 && xhr.status === 200){
            cb(xhr.responseText)
        }
    }
    xhr.send();
}


function ajaxPost(url, cb, data){
    data = data || {};
    let str = "";
    for(let i in data){
        str += `${i}=${data[i]}&`;
    }
    const xhr = new XMLHttpRequest();
    xhr.open("post", url, true);
    xhr.onreadystatechange = function(){
        if(xhr.readyState === 4 && xhr.status === 200){
            cb(xhr.responseText)
        }
    }
    // 3. post的数据，在send中传输
    xhr.send(str.slice(0,str.length-1));
}